<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import jwtDecode from "jwt-decode";
export default {
  created() {
    if (localStorage.moneyToken) {
      let decoded = jwtDecode(localStorage.moneyToken);
      this.$store.dispatch("SetIsAuthenticated", !this.isEmpty(decoded));
      this.$store.dispatch("SetUser", decoded);
    }
  },
  methods: {
    isEmpty(value) {
      return (
        value === undefined ||
        value === null ||
        (typeof value === "object" && Object.keys(value).length === 0) ||
        (typeof value === "string" && value.trim().length === 0)
      );
    },
  },
};
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
html,
body,
#app {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
</style>
